
<?php
// Script to check if user has been inactive for 10min and then log him out
// set timeout period in seconds
$inactive = 600;

// check to see if $_SESSION['timeout'] is set
if (isset($_SESSION['timeout'])) {
    $session_life = time() - $_SESSION['timeout'];
    if ($session_life > $inactive) {
        header("Location: logout.php");
    }
}
$_SESSION['timeout'] = time();
///////////////////////////////////////////////////////////////////////
?>
<div id="top">
    <div id="logo" style="width: 50%"><a href="overview.php"><img src="img/EasyChartsLogo1small.png" style="margin-bottom: -2px;"/></a> EasyCharts</div>
    <div id="headerright">
        <a>Logged in as: <?php echo "<b>" . $_SESSION["valid_username"] . "</b>" ?></a>
         | 
        <a href="userprofile.php">Userprofile</a>
         | 
        <?php if($_SESSION["valid_admin"] == 1){ echo "<a href='adminpage.php'>Adminpanel</a> | "; } ?>
        <a href="logout.php">Log out</a>        
    </div>
</div>
